/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quizzempire.model.statemachine;

import quizzempire.model.Model;
import quizzempire.model.Quizz;

/**
 *
 * @author Paulo
 */
public class QuizzConfiguration extends State {
    
    Quizz activeQuizz;

    public QuizzConfiguration(Model modelo) {   
        super(modelo);
        activeQuizz=modelo.getActiveQuizz();
    }

    @Override
    public State editQuestions() {
        modelo.setChanges();
        return new QuestionEditor(modelo);
    }

    @Override
    public State setName(String name) {
        activeQuizz.setName(name);
        return this;
    }

    @Override
    public State setCreator(String creator) {
        activeQuizz.setAuthor(creator);
        return this;
    }

    @Override
    public State setDescription(String description) {
        activeQuizz.setDescription(description);
        return this;
    }

    @Override
    public State setDifficulties(boolean[] difficulties) {
        activeQuizz.setDifAvailable(difficulties);
        return this;
    }

    @Override
    public State setGenre(String genre) {
        activeQuizz.setGenre(genre);
        return this;
    }

    @Override
    public State setPassword(String password) {
        activeQuizz.setPassword(password);
        return this;
    }

    @Override
    public State setNQuestions(int[] questionPerLevel) {
        activeQuizz.setNumEasy(questionPerLevel[0]);
        activeQuizz.setNumNormal(questionPerLevel[1]);
        activeQuizz.setNumHard(questionPerLevel[2]);
        return this;
    }

    @Override
    public State restart() {
        modelo.setChanges();
        return new AwaitsInstruction(modelo);
    }
    
    
    
    
    
    
    
    
    
    
    
    
}
